home *** CD-ROM | disk | FTP | other *** search
GW-BASIC | 1984-07-27 | 2.4 KB | 68 lines |
- 10 ' ***
- 20 ' *** LISSAJOUS FIGURES ***
- 30 ' *** Taken from Compute!'s PC&PC-jr Magazine, May 1984 Issue 3 Vol. 1 #3
- 40 ' *** Entered by Jim Kloss of NOCHANGE - Atlanta Ga.
- 50 ' *** NOCHANGE BBS Phone Number (404)587-4198
- 60 ' ***
- 70 SCREEN 1:CLS:KEY OFF
- 80 PRINT "Lissajous Figures":PRINT:PRINT
- 90 PRINT "Introduction (Y or N)?"
- 100 Q$=INKEY$:IF Q$="" THEN 100
- 110 IF Q$="Y" OR Q$="y" THEN GOSUB 440
- 120 CLS
- 130 INPUT "Frequency ratio -- (any number) :";FREQ:PRINT
- 140 INPUT "Phase difference (-360 to 360) :";PHASE
- 150 PRINT
- 160 PRINT "Press spacebar to freeze display!"
- 170 PRINT "(and again to unfreeze!)"
- 180 PRINT:PRINT "Press E to end."
- 190 LOCATE 25,1
- 200 PRINT "(Press any key now to start ...)";
- 210 IF INKEY$="" THEN 210
- 220 CLS
- 230 LOCATE 1,1:PRINT "1:";FREQ
- 240 LOCATE 3,1:PRINT PHASE
- 250 PRINT "Degrees"
- 260 PI=3.14159:FACTOR=180/PI
- 270 PHASE=PHASE/FACTOR
- 280 DEF FNX(Q)=160+90*SIN(Q)
- 290 DEF FNY(Q)=100+90*SIN(Q)
- 300 '*** Plot first two points ***
- 310 LINE (FNX(0),FNY(FREQ*PHASE))-(FNX(0.1),FNY(FREQ*(0.1+PHASE))),2
- 320 THETA=0.2
- 330 LINE -(FNX(THETA),FNY(FREQ*(THETA+PHASE))),2
- 340 THETA=THETA+0.05
- 350 Q$=INKEY$
- 360 IF Q$<>" " THEN 380
- 370 IF INKEY$="" THEN 370
- 380 IF Q$<>"E" AND Q$<>"e" THEN 330
- 390 CLS:PRINT "Another (Y or N)?"
- 400 Q$=INKEY$
- 410 IF Q$="" THEN 400
- 420 IF Q$="Y" OR Q$="y" THEN 70
- 430 CLS:KEY ON:SCREEN 0:WIDTH 80:END
- 440 SCREEN 0:WIDTH 80
- 450 PRINT " Here is a program that draws Lissajous figures on the screen"
- 460 PRINT "of an IBM-PC or PCjr. It traces out the path of a point described"
- 470 PRINT "by two sine-wave functions whose phase and frequency relationship is"
- 480 PRINT "specified by the user.
- 490 PRINT " Fortunately, you don't have to know anything about sine-wave
- 500 PRINT "functions to use the program. Just think of it as asking for two
- 510 PRINT "numbers: a frequency ratio, which can be any nonzero number, and
- 520 PRINT "a phase angle, which is measured in degrees (all possible values
- 530 PRINT "occur in the range 0 to 360, though you can enter any number that
- 540 PRINT "you want!) Start with a frequency ratio of 1 and experiment with
- 550 PRINT "changing the phase angle: 0, 45, 90, 180, and so forth. Then try
- 560 PRINT "whole number frequency ratios: 2, 3, 4. Finally, try varying both
- 570 PRINT "frequency ratio and phase angle in any way that you like!
- 580 PRINT " Some good ones to start with are:
- 590 PRINT "Freq = 1.3 Degrees = 60
- 600 PRINT "Freq = 1.05 Degrees = 60
- 610 PRINT "Freq = .801 Degrees = 0
- 620 PRINT "Freq = 1.05 Degrees = 180
- 630 PRINT:PRINT
- 640 PRINT "Hit any key to continue ..."
- 650 Q$=INKEY$:IF Q$="" THEN 650
- 660 SCREEN 1
- 670 RETURN
-